<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<jsp:include page="../common/common.jsp"></jsp:include>

</head>
<body>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/crud.js" ></script>
	<script type="text/javascript">
	var tbId     ='tt';
	var dialogId    ='dd';
	var formId      ='ff';
	var baseUrl     ='${pageContext.request.contextPath}/class/';
	$(function() {
		//alert("onload方法....");
		var url = baseUrl+'findAllClass.do';
		//var tableId ='mainTableId';
		var title = '主表选项';
		var toolbarId = 'myTool';
		initpage(tbId,title,toolbarId,url)
});
	function update(){
		var url   =baseUrl+'findById.do?id=';
		var title='修改';
		edit(tbId,title,formId,url);
	}
	function addStudent(){
		title='添加';
		add(title,dialogId,formId)
	}
	function dels(){
		var url=baseUrl+'deleteByIds.do';
		del(tbId,url);
	}
	function certains(){
		var url=baseUrl;
		certain(str,formId,url,dialogId,tbId);
	}
	
	//查询
	function searchName() {
		var className =$("input[name=class]").val();
		//load作用：装载第一次进入页面的请求，并且可以传递参数，参数列表用对象包装
		$("#"+tbId).datagrid('load',{
			 'className':className,	 
			});
	}
	
	</script>
	<table id="tt">
		<thead>
				<tr>
					<th data-options="field:'id',checkbox:true" width="80" >ID</th>
					<th field="className" width="100">班级名称</th>
					<th field="persons" width="100">班级人数</th>
					<th field="teacher" width="100">班级老师</th>
				</tr>
		</thead>
	</table>
	<div id="myTool">
		<form id="mySearch" action="">
		     姓名:<input id="searchBox" tboxclass="easyui-text" name="class" />
			<a href="#" class="easyui-linkbutton" iconCls="icon-search"
				plain="ture" onclick="searchName()">查询</a>
		</form>
		<a class="easyui-linkbutton" iconCls="icon-add" onclick="addStudent();">增加</a>
		<a class="easyui-linkbutton" iconCls="icon-remove" onclick="dels();">删除</a>
		<a class="easyui-linkbutton" iconCls="icon-edit" onclick="update();">修改</a>
	</div>
	<div id="dd" style="display: none;">
		<form method="post" id="ff">
			<table>
				<tr>
					<td>班级名称:</td>
					<td><input type="text" class="easyui-validatebox"
						name="className" data-options="required:true"></td>
					<input type="hidden" name="id">
				</tr>
				<tr>
					<td>班级人数:</td>
					<td><input type="text" class="easyui-validatebox"
						name="persons" data-options="required:true"></td>
				</tr>
				<tr>
					<td>班级老师:</td>
					<td><input type="text" class="easyui-validatebox"
						name="teacher" data-options="required:true"></td>
				</tr>
				<tr>
					<td><a class="easyui-linkbutton" iconCls="icon-ok"
						onclick="certains();">确定 </a></td>
					<td><a class="easyui-linkbutton" iconCls="icon-undo">取消</a></td>
				</tr>
			</table>
		</form>
	</div>
</body>

</html>